var mysql = require('mysql');
var config = require('../../config');
var pool = mysql.createPool({
    host     : config.mysqlhost,
    user     : config.mysqluser,
    password : config.mysqlpassword,
    database : config.mysqldb,
    connectionLimit: 10
});

exports.mysqlquery = function(querysql,values,callback){
    if (values) {
        if (values.length > 0) {
            pool.query(querysql, values, callback);
        } else {
            pool.query(querysql, callback);
        }
    } else pool.query(querysql, callback);
}

// pool.query('SELECT 1 + 1 AS solution', function(err, rows, fields) {
//     if (err) throw err;
//     console.log('The solution is: ', rows[0].solution);
// });